import sqlite3

class Storage:
    def __init__(self, db_file):
        self.connection = sqlite3.connect(db_file)
        self.create_tables()

    def create_tables(self):
        with self.connection:
            self.connection.execute("""CREATE TABLE IF NOT EXISTS posts (
                id INTEGER PRIMARY KEY AUTOINCREMENT,
                content TEXT,
                author TEXT
            )""")
            self.connection.execute("""CREATE TABLE IF NOT EXISTS jobs (
                job_id INTEGER PRIMARY KEY,
                creator TEXT,
                description TEXT,
                bounty REAL,
                completed BOOLEAN,
                applicants TEXT
            )""")

    def insert_post(self, content, author):
        with self.connection:
            self.connection.execute("INSERT INTO posts (content, author) VALUES (?, ?)", (content, author))

    def query_all_posts(self):
        cursor = self.connection.execute("SELECT content, author FROM posts")
        return [{"content": row[0], "author": row[1]} for row in cursor.fetchall()]

    def insert_job(self, job_id, creator, description, bounty):
        with self.connection:
            self.connection.execute("INSERT INTO jobs (job_id, creator, description, bounty, completed, applicants) VALUES (?, ?, ?, ?, ?, ?)", 
                                    (job_id, creator, description, bounty, False, ""))

    def get_jobs(self):
        cursor = self.connection.execute("SELECT job_id, creator, description, bounty, completed FROM jobs")
        return [{"job_id": row[0], "creator": row[1], "description": row[2], "bounty": row[3], "completed": row[4]} for row in cursor.fetchall()]

    def apply_for_job(self, job_id, applicant):
        with self.connection:
            job = self.connection.execute("SELECT applicants FROM jobs WHERE job_id = ?", (job_id,)).fetchone()
            if job:
                applicants = job[0]
                if applicants:
                    new_applicants = applicants + "," + applicant
                else:
                    new_applicants = applicant
                self.connection.execute("UPDATE jobs SET applicants = ? WHERE job_id = ?", (new_applicants, job_id))

3. ai_assistant.py - AI助手模块

from transformers import pipeline

class AIAssistant:
    def __init__(self):
        self.moderation_model = pipeline("text-classification", model="path/to/model")
        
    def moderate_content(self, content):
        result = self.moderation_model(content)
        return result
